home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Application / WindowLocator.cp < prev    next >
Text File  |  2000-06-23  |  672b  |  34 lines

  1. // WindowLocator.cp
  2.  
  3. #ifndef WindowLocator_h
  4. #include "WindowLocator.h"
  5. #endif
  6. #ifndef StrangeWindow_h
  7. #include "StrangeWindow.h"
  8. #endif
  9. #ifndef RedBlackLinkTree_h
  10. #include "RedBlackLinkTree.h"
  11. #endif
  12.  
  13. WindowLocator::TreeType& WindowLocator::Tree()
  14.   {
  15.     static TreeType tree;
  16.     return tree;
  17.   }
  18.  
  19. void WindowLocator::Register( Registration& registation )
  20.   {
  21.     Tree().Add( registation );
  22.   }
  23.  
  24. AbstractWindow& WindowLocator::LocateWindow( WindowObject& theWindow )
  25.   {
  26.     Registration *registration = Tree().Find( &theWindow );
  27.     if ( registration != 0 )
  28.         return **registration;
  29.     
  30.     static StrangeWindow strange( 0 );
  31.     strange = StrangeWindow( &theWindow );
  32.     return strange;
  33.   }
  34.